<?php
/**
 * 返回新闻幻灯片xml文档
 * 以json方式返回
 * solosky <solosky772@qq.com>
 */

include_once("common.php");

$cate = parseCategory(getVar($_GET, "category"));
$pre  = $config["DB_PREX"]; 
$limit = getVar($_REQUEST,"limit",5,"int");
$sql  = "SELECT title,url,thumb FROM {$pre}news WHERE thumb!='' AND categoryhash IN (".implode(",",$cate).") ORDER BY date DESC LIMIT {$limit}";
$db->query($sql);
$rows = $db->getRows();

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
?>
<data>
	<channel>
        <?php
		$thumbs = null;
		$xml = "";
		for($i=0; $i<count($rows); $i++){
			$thumbs = explode("|",$rows[$i]["thumb"]);
			$xml .= "<item>\n";
			$xml .= "	<link>".$rows[$i]["url"]."</link>\n";
			$xml .= "	<image>./server/media.php?media=".$thumbs[0]."&size=small</image>\n";
			$xml .= "	<title>".$rows[$i]["title"]."</title>\n";
			$xml .="</item>\n";
		}
		echo $xml;
		?>
	</channel>
	<config>	
		<roundCorner>0</roundCorner>
		<autoPlayTime>5</autoPlayTime>
		<isHeightQuality>true</isHeightQuality>
		<blendMode>normal</blendMode>
		<transDuration>1</transDuration>
		<windowOpen>_self</windowOpen>
		<btnSetMargin>auto 5 5 auto</btnSetMargin>
		<btnDistance>20</btnDistance>
		<titleBgColor>0xff6600</titleBgColor>
		<titleTextColor>0xffffff</titleTextColor>
		<titleBgAlpha>.75</titleBgAlpha>
		<titleMoveDuration>1</titleMoveDuration>
		<btnAlpha>.7</btnAlpha>	
		<btnTextColor>0xffffff</btnTextColor>	
		<btnDefaultColor>0x1B3433</btnDefaultColor>
		<btnHoverColor>0xff9900</btnHoverColor>
		<btnFocusColor>0xff6600</btnFocusColor>
		<changImageMode>click</changImageMode>
		<isShowBtn>true</isShowBtn>
		<isShowTitle>true</isShowTitle>
		<scaleMode>noBorder</scaleMode>
		<transform>blur</transform>
		<isShowAbout>true</isShowAbout>
		<titleFont>微软雅黑</titleFont>
	</config>
</data>
        